package com.freelance.vn.apps.puzzle.task;

import java.util.concurrent.atomic.AtomicBoolean;

import android.os.AsyncTask;

public abstract class AbstractTask<TParam, TProgress, TResult>
	implements Runnable {
    
    /** use to notify the result to UI. */
    protected IDataEventHandler<TResult> mDataEventHandler;
    
    public AbstractTask(IDataEventHandler<TResult> dataEventHandler) {
        mDataEventHandler = dataEventHandler;
    }
	
	protected final AtomicBoolean mShouldCancel = new AtomicBoolean(false);

	
	public boolean getShouldCancel() {
		return mShouldCancel.get();
	}

	
	public void setShouldCancel(boolean shouldCancel) {
		this.mShouldCancel.set(shouldCancel);
	}	
}